package com.stylefeng.guns.rest.modular.wz.api.v3;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.rest.common.base.controller.ApiBaseController;
import com.stylefeng.guns.rest.common.constant.Consts;
import com.stylefeng.guns.rest.common.persistence.dao.WzCouponMapper;
import com.stylefeng.guns.rest.common.persistence.dao.WzCouponMarketMapper;
import com.stylefeng.guns.rest.common.persistence.dao.WzMapActivityMapper;
import com.stylefeng.guns.rest.common.persistence.model.*;
import com.stylefeng.guns.rest.domain.ParamMap;
import com.stylefeng.guns.rest.domain.Res;
import com.stylefeng.guns.rest.enums.EnWzCouponMarket;
import com.stylefeng.guns.rest.enums.EnWzMapActivity;
import com.stylefeng.guns.rest.enums.EnWzMapRebate;
import com.stylefeng.guns.rest.modular.auth.util.JwtTokenUtil;
import com.stylefeng.guns.rest.modular.wz.cache.CacheService;
import com.stylefeng.guns.rest.modular.wz.service.impl.WzCouponMarketServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 券库接口
 */
@RestController
@RequestMapping("/wz/api/v3/couponMarket/")
public class WzCouponMarketApiV3 extends ApiBaseController {

    @Autowired
    private CacheService cacheService;
    @Autowired
    private JwtTokenUtil jwtTokenUtil;
    @Autowired
    private WzCouponMapper couponMapper;
    @Autowired
    private WzCouponMarketMapper couponMarketMapper;
    @Autowired
    private WzMapActivityMapper mapActivityMapper;
    @Autowired
    private WzCouponMarketServiceImpl couponMarketService;

    /**
     * 商户-券库-新增
     */
    @PostMapping("add")
    public Res add(@RequestBody ParamMap paramMap) throws Exception{
        Res res = couponMarketService.add(paramMap);
        return res;
    }

    /**
     * 商户-券库-编辑
     */
    @PostMapping("edit")
    public Res edit(@RequestBody ParamMap paramMap) throws Exception{
        Res res = couponMarketService.edit(paramMap);
        return res;
    }

    /**
     * 商户-券库-统计
     */
    @PostMapping("reward")
    public Res reward(@RequestBody ParamMap paramMap){
        Res res = couponMarketService.reward(paramMap);
        return res;
    }

    /**
     * 商户-券库-统计-商户记录
     */
    @PostMapping("merchantReward")
    public Res merchantReward(@RequestBody ParamMap paramMap){
        Res res = couponMarketService.merchantReward(paramMap);
        return res;
    }

    /**
     * 商户-券库-列表
     */
    @PostMapping("list")
    public Res list(@RequestBody ParamMap paramMap){
        Res res = couponMarketService.list(paramMap);
        return res;
    }

    /**
     * 商户-券库返利活动-列表
     */
    @PostMapping("rebateList")
    public Res rebateList(@RequestBody ParamMap paramMap){
        Res res = couponMarketService.couponMarketRebateList(paramMap);
        return res;
    }

    /**
     * 商户-券库返利活动-新增
     */
    @PostMapping("rebateAdd")
    public Res rebateAdd(@RequestBody ParamMap paramMap) throws Exception{
        Res res = couponMarketService.rebateAdd(paramMap);
        return res;
    }

    /**
     * 商户-券库返利活动-修改
     */
    @PostMapping("rebateEdit")
    public Res rebateEdit(@RequestBody ParamMap paramMap) throws Exception{
        Res res = couponMarketService.rebateEdit(paramMap);
        return res;
    }

    /**
     * 商户-券库返利活动-统计
     */
    @PostMapping("rebateReward")
    public Res rebateReward(@RequestBody ParamMap paramMap){
        Res res = couponMarketService.rebateReward(paramMap);
        return res;
    }
}
